package com.zuo.seckilldemo.utils;

import com.zuo.seckilldemo.entity.User;
import org.springframework.stereotype.Component;

@Component
public class UserThreadLocal{
    private UserThreadLocal (){
        
    }
    private static final  ThreadLocal<User> LOCAL = new InheritableThreadLocal<>();
    
    public static void set(User user){
        LOCAL.set(user);
    }
    
    public static User get(){
        return LOCAL.get();
    }
    
    public static void remove(){
        LOCAL.remove();
    }
}
